<template>
  <div class="app-container">
    <div class="filter-container">
      <el-page-header @back="backUp" class="backUp" content="被访问列表"></el-page-header>
    </div>
    <div class="filter-container-left">
      <el-form :inline="true">
        <el-form-item label="访问时间">
          <el-date-picker
            v-model="time"
            type="datetimerange"
            range-separator="至"
            start-placeholder="开始时间"
            end-placeholder="结束时间"
            value-format="yyyy-MM-dd HH:mm:ss"
            @change='timeChange'
            :picker-options="pickerOptions">
          </el-date-picker>
        </el-form-item>
        <el-button class="filter-item search" icon="el-icon-search" @click="handleSearch">查询</el-button>
        <el-button class="filter-item" icon="el-icon-refresh" @click="handleRefresh">重置</el-button>
      </el-form>
    </div>
    <div class="resume_info" v-if="data.length>0">
      <p>姓名：{{data[0].resume_info.user_info.full_name}}</p>
      <p>账号：{{data[0].resume_info.user_info.mobile}}</p>
    </div>
    <el-table
      :data="data"
      style="width: 100%;margin-bottom: 20px;"
      row-key="id"
      border
      default-expand-all
      :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
    >
      <!-- <el-table-column prop="id" label="序号" width='100'/> -->
      <el-table-column prop="company_info.name" label="企业名称"/>
      <el-table-column prop="user_info.mobile" label="账号"/>
      <el-table-column prop="create_time" label="访问时间"/>
      <el-table-column prop="company_info.contacts" label="联系人"/>
      <el-table-column prop="company_info.contacts_mobile" label="电话"/>
      <el-table-column label="操作" width='100'>
        <template slot-scope="item">
          <el-button type="primary" size='mini' icon="el-icon-view" @click="handleDetails(item.row.company_id)" />
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      background
      class="pagination-container"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="paginate.current"
      :hide-on-single-page='isHideSingle'
      :page-sizes="paginate.sizes"
      :page-size="paginate.limit"
      :layout="paginate.layout"
      :total="paginate.total"/>
  </div>
</template>

<script>
import formOperate from '@/layout/mixin/formOperate'
export default {
  name: 'Index',
  mixins: [formOperate],
  data() {
    return {
      url:'/profession/admin/resume/getBrowseList',
      queryParam: {
        start_time:'',
        end_time:'',
        page:1,
        page_size:10,
        type_id:''
      },
      time:'',
      defaultQueryParam:['page','page_size','type_id']
    }
  },
  mounted() {
    this.queryParam.type_id = this.$route.params.id
  },
  methods: {
    // 获取列表
    getList() {
      this.$http.post(this.url,this.queryParam).then(response => {
        if (response.code === 10000) {
          this.data = !response.data?[]:response.data.data?response.data.data:[]
        } else {
          this.$message.error(response.message)
        }
      })
    },
    // 查看详情
    handleDetails(id) {
      this.$router.push({path:'/talents/companyDetails',query:{id:id}})
    },
    backUp() {
      this.$router.go(-1)
    }
  },
  components:{
  }
}
</script>

<style lang="scss" scoped>
  .form-search-input{
    width: 150px;
  }
  .backUp{
    flex:1;
    min-width: 0;
    text-align: left;
  }
  .resume_info p{
    line-height: 30px;
    margin-bottom:8px;
  }
</style>